const store = require("./store")
const unSubscribe = store.subscribe(() => {
  console.log(store.getState())
})
console.log(store.getState(), "修改前")

// store.getState().name = 'kobe'; // 是这么修改吗？ NO

// 一定要通过派发action去修改
store.dispatch({ type: "changeNameAction", name: "kobe" })
store.dispatch({ type: "changeNameAction", name: "James" })

unSubscribe() // store.subscribe返回的是一个函数体，可以执行消除订阅
store.dispatch({ type: "changeAgeAction", age: -1 })

// console.log(store.getState(), '修改age后');
